home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group01b.txt
/
000049_icon-group-sender_Wed Mar 7 08:13:17 2001.msg
< prev
next >
Wrap
Internet Message Format
|
2002-01-03
|
4KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id f27FDDo15367
for icon-group-addresses; Wed, 7 Mar 2001 08:13:13 -0700 (MST)
Message-Id: <200103071513.f27FDDo15367@baskerville.CS.Arizona.EDU>
From: "Wade Humeniuk" <humeniuw@cadvision.com>
X-Newsgroups: comp.lang.apl,comp.lang.forth,comp.lang.icon,comp.lang.lisp,comp.lang.mumps,comp.lang.scheme,comp.lang.smalltalk
Subject: Re: New Scientist Puzzle
Date: Tue, 6 Mar 2001 18:29:08 -0700
X-Trace: news3.cadvision.com 983932117 3919 207.148.137.216 (7 Mar 2001 02:28:37 GMT)
X-Complaints-To: news@cadvision.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 3219
You missed Marc Battyani's solution. The Lisp versions you included look a
little verbose.
--------------->>>>>>
I should work, but couldn't resist...
A Lisp version:
(let ((sqrs (loop for i from (ceiling (sqrt 1000)) upto (isqrt 9999)
collect (format nil "~d" (* i i))))
(vns '()))
(dolist (vier sqrs)
(dolist (neun sqrs)
(when (and (char= (aref neun 0)(aref neun 3))
(char= (aref vier 2)(aref neun 1))
(char/= (aref vier 0)(aref vier 1)(aref vier 2)
(aref vier 3)(aref neun 0)(aref neun 2)))
(push (list vier neun) vns))))
(loop for (v n) in vns do
(if (= 1 (count v vns :key #'first)(count n vns :key #'second))
(format t "~%Found ~a ~a~%~%" v n))))
Found 6241 9409
Marc
"Steve Graham" <js.graham@home.com> wrote in message
news:ERfp6.359416$ge4.127024410@news2.rdc2.tx.home.com...
> Stefano,
>
> I'm been quite pleased with the reception which this puzzle has
received,
> particularly in the APL newsgroup. You can see a compilation of most of
the
> solutions at http://members.home.net/js.graham/vierneun.html
>
> Best of luck.
>
>
> Steve Graham
>
> P.S. Would anyone be interested in another, slightly more complex
puzzle???
>
> ===
>
> "Stefano Lanzavecchia" <lstefano@hotmail.com> wrote in message
> news:9832qa$bbb$1@pegasus.tiscalinet.it...
> > To all the peopl who have posted solutions.
> > I am collecting them and will publish a few, in particular the APL and J
> > ones but some written in other languages as well for comparison,
hopefully
> > not to feed a silly language flame war, on a small magazine of the
British
> > APL Association, for which I am now the editor.
> > You can have a look at an online version of the magazine at this
webpage:
> > http://www.vector.org.uk/ where you can find sample of articles
published
> in
> > the printed version. As you can see while a serious magazine, it's also
> > reasonably informal, therefore there is no shame at all involved in
having
> > published code which could be thought as less than optimal. Instead,
> there's
> > a good chance that a version quickly hacked together would have some
> > pedagogic and exemplar value because it shows what the language is
capable
> > of when put to the edges.
> >
> > Anyway, my question is: if the author of any of the solution appeared in
> > these newsgroups (I have APL, J, K, MUMPS, Common Lisp, Dylan,
Smalltalk,
> > Perl, Python from which to choose from) strongly objects to have his
> > solution published against his or her name, to please let me know and I
> will
> > remove the solution from my pool. Otherwise I'll work on the assumption
> that
> > by posting a message in a public newsgroups the author implicitely
> indicated
> > that, while not necessary proud, does not mind to see his work published
> for
> > public consumption.
> >
> > By the way, it's quite likely that the readers of Vector are less than
the
> > sums of the readers of these newgroups...
> >
> > Thank you everybody, and I hope you shared my fun in the solution of the
> > little puzzle and in the comparison of the different languages.
> > --
> > WildHeart'2k1 (at home)
> >
> >
>
>